#include "SignalManager.h"
#include "ap/NetIPCP.h"
#include "ap/NetAPCP.h"
#include "ap/NetAPTM.h"
#include "ap/AudioNetIPCP.h"

namespace ecarx::transfer {

    SignalManager::SignalManager() : IPCPSignalManager(std::make_shared<ipcp::IPCPConn>()),
                                     APTMSignalManager(std::make_shared<aptm::APTMConn>()),
                                     APCPSignalManager(std::make_shared<apcp::APCPConn>()),
                                     AudioIPCPSignalManager(std::make_shared<ipcp::AudioIPCPConn>()){
        mConns.push_back(mIPCPConn);
        mConns.push_back(mAudioIPCPConn);
        mConns.push_back(mAPCPConn);
    }

    SignalManager& SignalManager::getInstance(){
        static SignalManager signalManager;
        return signalManager;
    }

    std::vector<std::shared_ptr<ITransfer>>& SignalManager::getTransfers(){
        return mConns;
    }

    bool SignalManager::enterStrMode() {
        for (auto& condition : mConns) {
            condition->enterStrMode();
        }
        return true;
    }

    bool SignalManager::exitStrMode() {
        for (auto& condition : mConns) {
            condition->exitStrMode();
        }
        return true;
    }
}